<?php

namespace App\Http\Model;



class BundleGoods extends Base
{
    /**
     * 定义数据库表名
     *
     * @var string
     */
    protected $table = 'bundle_goods';

    /**
     * 定义主键名
     *
     * @var string
     */
    protected $primaryKey = 'id';

    protected $fillable = [
        'goods_id',
        'sku_id',
        'count',
        'provider_id',
    ];


    public function bundle()
    {
        return $this->belongsTo(Bundle::class, 'bundle_id', 'id');
    }

    public function goods()
    {
        return $this->hasOne(Goods::class, 'goods_id', 'goods_id');
    }

    public function sku()
    {
        return $this->hasOne(GoodsSku::class, 'sku_id', 'sku_id');
    }

}
